package com.tcm.im.service;


import com.base.core.exception.ServiceException;
import com.tcm.im.dto.*;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface HxService {

    Token getToken() throws Exception;

    Boolean addUser(String username) throws Exception;

    /**
     * 删除用户
     *
     * @param username 用户名
     */
    boolean deleteUser(String username) ;

    /**
     * 添加好友
     *
     * @param ownerUsername 用户名
     * @param friendName    好友用户名
     * @return 是否成功
     */
    @Transactional
    boolean addUserFriend(String ownerUsername, String friendName) throws Exception;

    @Transactional
    boolean addDoctorFriend(String ownerUsername, String friendName) throws Exception;

    List<ImDoctorFriendsDTO> listFriends(Long ownerUsername);

    List<ImUserFriendsDTO> listUserFriends(Long ownerUsername);

    List<ImChatDTO> listFriendsOnlineForDoctor(Long ownerUsername) throws Exception;

    List<ImChatDTO> listFriendsOnlineForUser(Long ownerUsername);

    /**
     * 删除好友
     *
     * @param ownerUsername 用户名
     * @param friendName    好友用户名
     * @return 是否成功
     */
    boolean deleteFriend(String ownerUsername, String friendName) throws Exception;

    /**
     * 发送消息
     *
     * @param msg  发送消息
     * @return 是否成功
     */
    @Transactional
    String saveSessionData(ImChatDTO msg) throws ServiceException;

    /**
     * 创建会话
     *
     * @param onlineDTO        发送消息
     * @param direction true为患者向医生发送消息，否则false为医生向患者发送消息
     * @return 是否成功
     */
    @Transactional
    String createSession(ImOnlineDTO onlineDTO, Boolean direction) throws ServiceException;

    boolean saveDoctorPatient(String param) throws ServiceException;
}
